using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DragonAwakening.Core.Game;

namespace DragonAwakening.Game.Creatures
{
    public class Wolf : Creature
    {
        public Wolf(byte id)
        {
            this.Id = id;
            this.TextureId = "wolf";
            this.IsAggressive = true;

            this.Speed = new MaxValueData { Current = 8, Max = 8 };
            this.Name = "White Wolf";
        }

        public override bool Turn(IGameContext game, List<KeyValuePair<string, float>> messages)
        {
            var first = game.Group.FirstOrDefault(x => x.Health.Current > 0);
            if (first != null)
            {
                var hit = Dice.Roll(20) + 7;
                if (hit > first.ArmorClass.Current)
                {
                    var damage = Dice.Roll(6) + 5;
                    first.TakeDamage(damage, game, messages);

                    messages.Add(new KeyValuePair<string, float>(string.Format("{0} bites {1} with {2} damage.", this.Name, first.Name, damage), 1.0F));
                }
                else
                {
                    messages.Add(new KeyValuePair<string, float>(string.Format("{0} bite misses {1}.", this.Name, first.Name), 1.0F));
                }
            }
            return true;
        }
    }
}
